package proto

import (
	"regexp"
	"strings"
	D "websocket_apn/define"
)

// 解析仙宫信息
func ParaXianGongInfo(dataBytes []byte) D.XianGongInfo {
	allInfo := D.XianGongInfo{}
	data := BytesToHexStr(dataBytes)
	// 					                  1 ID
	re := regexp.MustCompile(`120808([0-9A-F]{6})10011801`)
	res := re.FindAllStringSubmatch(data, -1)
	if len(res) > 0 {
		for _, regRes := range res {
			allInfo.Id = append(allInfo.Id, regRes[1])
		}
	}
	if strings.Contains(data, "20012800") {
		allInfo.NeedAppreciate = true
	}
	return allInfo
}
